<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>个人信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layuimini/lib/layui-v2.6.3/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/layuimini/css/layuimini.css}" media="all">
    <link rel="stylesheet" th:href="@{/layuimini/css/public.css}" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form layuimini-form layui-form-pane" lay-filter="userForm">
            <input type="hidden" name="userId" th:value="${sysUser?.userId}">
            <div class="layui-form-item">
                <label class="layui-form-label required">用户名</label>
                <div class="layui-input-block">
                    <input type="text" name="userName" lay-verify="required" lay-reqtext="请输入用户名" placeholder="请输入用户名" th:value="${sysUser?.username}" class="layui-input">
                    <tip>若用户名已存在，请修改唯一的用户名</tip>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">用户姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="nickName" lay-verify="required" lay-reqtext="请输入用户姓名" placeholder="请输入用户姓名" th:value="${sysUser?.nickName}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">头像</label>
                <div class="layui-input-block">
                    <input type="hidden" name="userFace">
                    <div style="height: 100px;width: 100px;position: relative;">
                        <img th:src="${sysUser?.userAvatar}" alt="" id="pic-img" style="height: 100%;width: 100%;position: absolute;left: 0;top: 0;border: 1px solid #1E9FFF;border-radius: 50%">
                    </div>
                </div>
            </div>
<!--            <div class="layui-form-item">-->
<!--                <label class="layui-form-label">所属科室</label>-->
<!--                <div class="layui-input-block">-->
<!--                    <select name="deptId">-->
<!--                        <option value="">请选择</option>-->
<!--&lt;!&ndash;                        <option th:each="item : ${sex}" th:value="${item.code}" th:text="${item.name}"></option>&ndash;&gt;-->
<!--                    </select>-->
<!--                </div>-->
<!--            </div>-->
            <div class="layui-form-item">
                <label class="layui-form-label required">联系电话</label>
                <div class="layui-input-block">
                    <input type="number" name="userPhone" lay-verify="required|phone" lay-reqtext="联系电话不能为空" placeholder="请输入联系电话" th:value="${sysUser?.userPhone}"  class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">电子邮箱</label>
                <div class="layui-input-block">
                    <input type="email" name="userEmail"  placeholder="电子邮箱" th:value="${sysUser?.userEmail}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">联系地址</label>
                <div class="layui-input-block">
                    <input type="email" name="userAddr"  placeholder="请输入联系地址"  th:value="${sysUser?.userAddr}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注信息</label>
                <div class="layui-input-block">
                    <textarea name="remark" class="layui-textarea" placeholder="请输入备注信息" th:text="${sysUser?.remark}"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/layuimini/lib/layui-v2.6.3/layui.js}" charset="utf-8"></script>
<script th:src="@{/layuimini/js/lay-config.js?v=1.0.4}" charset="utf-8"></script>
<script type="text/javascript" th:inline="javascript">
    layui.use(['form','notice'], function () {
        let $ = layui.jquery,
            form = layui.form,
            notice = layui.notice;

        let ctxPath = /*[[@{/}]]*/'';

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.ajax({
                type:'PUT',
                url:ctxPath+'system/sysUser/updateUser',
                data:JSON.stringify(data.field),
                contentType: 'application/json;charset=utf-8;',
                dataType:'json',
                success:function (res){
                    notice.success(res.msg);
                }
            });
            return false;
        });
    });
</script>
</body>
</html>